package org.wqp.redisson.main;

import com.alibaba.fastjson.JSON;
import org.redisson.Redisson;
import org.redisson.api.RList;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.wqp.redisson.entity.User;
import org.wqp.redisson.utils.RedissonUtil;

import javax.sound.midi.Soundbank;
import java.io.File;
import java.io.IOException;

public class TestRList {
    public static void main(String[] args) {

       RList<User> list = RedissonUtil.getRedissonClient().getList("UserList");
       list.add(new User(1, "test1"));
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        User user = list.get(0);
        System.out.println("user[0] = " + JSON.toJSONString(user));
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        list.remove(user);

        RedissonUtil.shutdown();
    }
}
